package changceilingcolor003;

import toxi.physics.VerletParticle;
import toxi.physics.VerletSpring;

public class SpringClass {

	ChangCeilingColor003 p5;
	VerletParticle p1, p2;
	float RESTLENGTH, FORCESPRING;
	VerletSpring spring;
	int bColor;
	
	SpringClass (ChangCeilingColor003 _p5, VerletParticle _p1, VerletParticle _p2, float _RESTLENGTH, float _FORCESPRING, int _bColor){
	p5 = _p5;
	p1 = _p1;
	p2 = _p2;
	RESTLENGTH = _RESTLENGTH;
	FORCESPRING = _FORCESPRING;	
	bColor = _bColor;
	
	spring = new VerletSpring ( _p1, _p2, RESTLENGTH, FORCESPRING);
	p5.physics.addSpring(spring);
	
	}
	
	void run(){
		render();
	}
	
	void render (){
		p5.stroke(255,255,bColor);
		p5.strokeWeight(2);
		p5.line(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z);
	}
	
	
	
	
}
